﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;


public partial class Hospital_TraBackPlanAdd : System.Web.UI.Page, HZ.MBSM.BLL.TraDes
{
    string projectid;

    protected void Page_Load(object sender, EventArgs e)
    {
        projectid = SysFun.IsSQL(SysFun.ToTrim(Request.QueryString["projectid"]));
        System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumHospitale);
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))
        {
            HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
            if (_Account != null)
            {
                string _strHospitalName = _Account.DWName;
                txtPlanName.Text = _strHospitalName + System.DateTime.Now.ToShortDateString() + "退货单";
                txtStartTime.Text = System.DateTime.Now.ToShortDateString();
            }
        }

    }





    protected void BtnSave_Click(object sender, EventArgs e)
    {
        HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
        string strsql;
        strsql = "insert into BackPlan(PlanName,Projectid,AccountId_YY,StartTime,Remarks,BuildTime,BuyStatus) values(";
        strsql = strsql + "'" + SysFun.ToTrim(txtPlanName.Text) + "','" + projectid + "'," + _Account.AccountId + ",'" + SysFun.ToTrim(txtStartTime.Text) + "','" + SysFun.ToTrim(txtRemarks.Text) + "','" + System.DateTime.Now + "','0')";
        Db db = new Db();
        db.Command(strsql);
        db.Close();
        HZ.MBSM.BLL.LogManage.RecordLoginDetail(_Account.AccountName, Request.UserHostAddress, "插入", "BackPlan", strsql, "../Hospital/TraBackPlanAdd.aspx");
        Response.Write("<script>window.alert('新增成功');window.location.href='TraBackPlanList.aspx?ProjectId=" + SysFun.IsSQL((Request.QueryString["ProjectId"]))+"';</script>");
    }



    #region TraDes 成员

    public string Name
    {
        get { return "新增退货单"; }
    }

    public string Describe
    {
        get { return "新增退货单"; }
    }

    public string ParentName
    {
        get { return "退货管理"; }
    }

    public System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> UseAccountType
    {
        get
        {
            System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
            _AccountType.Add(HZ.MBSM.DAL.AccountType.enumHospitale);
            return _AccountType;
        }
    }

    #endregion
}
